home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / strerror.c < prev    next >
C/C++ Source or Header  |  1991-11-27  |  526b  |  29 lines

  1. /*  $Revision: 1.1 $
  2. **
  3. **  Only <errno.h> is needed; the others are just to get the right sprintf()
  4. **  declaration, sigh.
  5. */
  6. #include <errno.h>
  7. #include <stdio.h>
  8. #include <sys/types.h>
  9. #include "configdata.h"
  10. #include "clibrary.h"
  11.  
  12.  
  13. /*
  14. **  Return a string representation of errno.
  15. */
  16. char *
  17. strerror(e)
  18.     int        e;
  19. {
  20.     extern int    sys_nerr;
  21.     extern char    *sys_errlist[];
  22.     static char    buff[30];
  23.  
  24.     if (e >= 0 && e < sys_nerr)
  25.     return sys_errlist[e];
  26.     (void)sprintf(buff, "Error code %d\n", e);
  27.     return buff;
  28. }
  29.